public Action OnRoundStart(Event event, const char[] name, bool dontBroadcast) { if (!alreadyDone) // prevent bug { return Plugin_Continue; }
alreadyDone = false; return Plugin_Continue; }
public Action OnPlayerUse(Event event, const char[] name, bool dontBroadcast) { if (alreadyDone) // in order to prevent spam { return Plugin_Continue; }
int usedTarget = event.GetInt("targetid"); if (usedTarget == -1 || !IsValidEntity(usedTarget) || !IsValidEdict(usedTarget)) { return Plugin_Continue; }
if (StrContains(targetModel, "checkpoint_door", false) != -1 && StrEqual(targetEnt, "prop_door_rotating_checkpoint", false)) // make sure the model is a checkpoint door and it is a checkpoint entity 'cause some maps have these models but are not real checkpoints and more like props. { alreadyDone = true;
if (targetModel[36] == '1' || targetModel[37] == '1') // 'cause some maps use saferoom models with a negative sign before 0. { // do stuff here } else if (targetModel[36] == '2' || targetModel[37] == '2') // same with the end saferoom. { // do stuff here } }
return Plugin_Continue; }
By far is much better as this event checks it all - the model, the entity classname, etc. I would recommend this even advise myself when making plugins involving entities.